﻿namespace DCHealthCheck.MvcWeb.Classes.ViewModels {

    #region Usings
    using DCHealthCheck.Common;
    using DCHealthCheck.DomainModel;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Threading;
    using System.Web; 
    #endregion

    public class HomeViewModel : BaseViewModel {

        #region Members
        public List<HealthCheckSummary> HealthCheckSummaries { get; set; } 
        #endregion

        #region Constructor
        public HomeViewModel() {
            Global.DefaultLog.DebugFormat("[ThreadId: {0}] {1}", Thread.CurrentThread.ManagedThreadId, Extensions.CurrentMethodName());
            this.HealthCheckSummaries = new List<HealthCheckSummary>();
        } 
        #endregion

        #region Methods
        public override void Initialize(){
            Global.DefaultLog.DebugFormat("[ThreadId: {0}] {1}", Thread.CurrentThread.ManagedThreadId, Extensions.CurrentMethodName());

            base.Initialize();
            if (string.IsNullOrWhiteSpace(this.SortColumn)) {
                this.SortColumn = "CheckDateTimeUTC";
            }

            if (!this.CurrentSortDirection.HasValue) {
                this.CurrentSortDirection = System.Web.Helpers.SortDirection.Descending;
            }
        } 
        #endregion
    }
}